<% layout('/layouts/default.html', {title: '缓存管理', libs: ['dataGrid']}){ %>
<div class="card bd-0">
    <div class="card-header d-flex align-items-start justify-content-between box-header">
      <div class="pt-1">缓存列表</div>
      <div class="d-flex">
          <button type="button" id="btnSearch" title="查询" class="btn btn-xs btn-default"><i  class="fa fa-filter"></i>查询</button>
      </div>
    </div>
    <div class="card-body pd-10">
      <#form:form id="searchForm" action="${ctx}/state/cache/listData" method="post"  class="form-horizontal"
				data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
        <div class="form-group">
          <div class="input-group wd-250">
            <div class="input-group-prepend">
              <span class="input-group-text">键值检索</span>
            </div>
            <#form:input name="pattern" placeholder="支持Redis正则表达式" class="form-control"/>
          </div>
        </div>
        <div class="form-group">
          <button type="submit" class="btn btn-primary btn-sm">查询</button>
          <button type="reset" class="btn btn-default btn-sm">重置</button>
        </div>
      </#form:form>
      <table id="dataGrid"></table>
      <div id="dataGridPage"></div>
    </div>
  </div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'缓存键值', name:'key', index:'key', align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/state/cache/form?key='+row.key+'&dataType='+row.dataType+'" class="btnList" data-title="编辑缓存">'+(val||row.id)+'</a>';
		}},
		{header:'缓存类型', name:'dataType', index:'dataType', width:100, fixed:true, align:"center"},
		{header:'操作', name:'actions', width:80, fixed:true,  sortable:false, title:false, formatter: function(val, obj, row, act){
			var actions = [];
				actions.push('<a href="${ctx}/state/cache/form?key='+row.key+'&dataType='+row.dataType+'" class="btnList" title="编辑缓存"><i class="la la-edit"></i></a>&nbsp;');
				actions.push('<a href="${ctx}/state/cache/delete?key='+row.key+'" class="btnList" title="删除缓存" data-confirm="确认要删除该缓存吗？"><i class="la la-trash"></i></a>&nbsp;');
			actions.push('</div>');
			
			return actions.join('');
		}}
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>
</body></html>